package vues;

import java.util.Observable;
import java.util.Observer;

import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;

import modele.ModeleP;
import modele.TableModel;
import controleurs.ResumeUpdateControler;
/**
 * Permet d'afficher la liste resultante des recherche.
 * @author Coudeville
 */
public class ResultFrame extends JPanel implements Observer, TableModelListener{


	private static final long serialVersionUID = 7627281535755880754L;
	@SuppressWarnings("unused")
	private ModeleP myModele;
	private JTable result;
	private TableModel myTabMod;
	/**
	 * Creer un panel "resultat"
	 * @param modele Le modele principale, permettant les recherches.
	 * @param myTab Le modele JTable, permettant la mise a jour de la table.
	 */
	public ResultFrame(ModeleP modele, TableModel myTab){
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		this.myModele=modele;
		this.myTabMod=myTab;
		result=new JTable(myTabMod);
		result.addMouseListener(new ResumeUpdateControler(modele, result));
		myTab.addTableModelListener(this);
		this.add(new JScrollPane(result));
		modele.addObserver(this);
	}
	public void update(Observable o, Object arg) {
	}
	public void tableChanged(TableModelEvent e) {
	}
}
